var order_evaluate={};

$(function(){
	$('.jsTagStar img').hover(order_evaluate.starHover);
	$('.jsTagStar').mouseout(order_evaluate.starOut);
	$('.jsTagStar img').click(order_evaluate.starClick);
	$('#gevalIsanonymous').click(order_evaluate.gevalIsanonymousClick);
});


order_evaluate.gevalIsanonymousClick = function(){
	if($(this).attr('checked') == 'checked'){
		$('input[name=gevalIsanonymous]').val(1);
	}else{
		$('input[name=gevalIsanonymous]').val(0);
	}
}

order_evaluate.starClick = function(){
	$('input', $(this).parent()).val($(this).attr('alt'));
}


order_evaluate.starHover = function(){
	var $div = $(this).parent();
	var select = parseInt($(this).attr('alt'));
	var imageList = $('img', $div);
	$.each(imageList, function(i, o){
		if(i+1 <= select){
			o.src = o.src.replace('star-off.png', 'star-on.png');
		}else{
			o.src = o.src.replace('star-on.png', 'star-off.png');
		}
	});
}

order_evaluate.starOut = function(){
	var $this = $(this);
	var selectStar = parseInt($('input', $this).val());
	$.each($('img', $this), function(i, o){
		if(i+1 <= selectStar){
			o.src = o.src.replace('star-off.png', 'star-on.png');
		}else{
			o.src = o.src.replace('star-on.png', 'star-off.png');
		}
	});
}